package IC.AST;

import java.util.LinkedList;

public class Program extends ASTNode
{
	private LinkedList<ClassDeclaration> _listOfClasses;
	private Library _library = null;
	private String _fileName = "";
	public Object Visit(Visitor visitor) { return visitor.Visit(this); }
	
	public Program(LinkedList<ClassDeclaration> listOfClasses)
	{
		super(new Interval());
		_listOfClasses = listOfClasses == null ? new LinkedList<ClassDeclaration>() : listOfClasses;
		for (ClassDeclaration classDeclaration : listOfClasses)
			GiveBirth(classDeclaration);
	}
	
	/**
	 * Can be set only ones, after that does nothing!
	 */
	public void SetLibrary(Library library)
	{
		if (_library != null)
			return;
		_library = library;
		GiveBirth(_library);
	}
	
	public Library GetLibrary() { return _library; }
	public String GetFileName() { return _fileName; }
	
	public LinkedList<ClassDeclaration> GetListOfClasses() { return _listOfClasses; }
}
